import django_filters

from apps.survey_system.question.models import Module
from apps.survey_system.survey.models import Survey, SurveyAccount, SurveyAnswer


class SurveyFilter(django_filters.rest_framework.FilterSet):
    name = django_filters.CharFilter(lookup_expr='icontains')

    class Meta:
        model = Survey
        fields = ['name', ]


class SurveyAccountFilter(django_filters.rest_framework.FilterSet):
    survey_name = django_filters.CharFilter(field_name='survey__name', lookup_expr='icontains')

    class Meta:
        model = SurveyAccount
        fields = ['survey_name', 'survey_id', 'status']


class SurveyAnswerFilter(django_filters.rest_framework.FilterSet):
    # survey_name = django_filters.CharFilter(field_name='survey__name', lookup_expr='icontains')

    class Meta:
        model = SurveyAnswer
        fields = ['answer_text', ]


class ModuleFilter(django_filters.rest_framework.FilterSet):
    name = django_filters.CharFilter(lookup_expr='icontains')

    class Meta:
        model = Module
        fields = ['name', ]